using System.Collections;
using System.Collections.Generic;
using OrderSystem;
using PureMVC.Interfaces;
using PureMVC.Patterns;
using UnityEngine;

/// <summary>
/// 服务员命令类，负责处理服务员分配和状态变更相关业务逻辑
/// 继承自PureMVC的SimpleCommand，协调服务员代理完成订单服务和状态管理
/// </summary>
public class WaiterCommend : SimpleCommand
{
    /// <summary>
    /// 执行命令，根据通知类型处理服务员分配或状态变更
    /// </summary>
    /// <param name="notification">包含订单或服务员信息的通知对象，Type属性指定操作类型：
    /// - "SHANGCAI": 分配服务员上菜
    /// - "WANSHI": 标记服务员为空闲状态
    /// </param>
    public override void Execute(INotification notification)
    {
        WaiterProxy waiterProxy = Facade.RetrieveProxy(WaiterProxy.NAME) as WaiterProxy;
        if (notification.Type == "SHANGCAI")
        {
            waiterProxy.ChangeWaiter(notification.Body as Order);
        }else if (notification.Type == "WANSHI")
        {
            waiterProxy.RemoveWaiter(notification.Body as WaiterItem);
        }
    }
}
